{extend name="Common/common" /}

{block name="style"}
<style>
    .layui-form {
        width: 825px;
    }
</style>
{/block}

{block name="content"}
<form id="form" class="layui-form" action="{:url('@admin/judge')}" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">评审名称：</label>
        <div class="layui-input-block">
            <input type="text" name="name" value="" required  lay-verify="required" placeholder="请输入评审名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">评审介绍：</label>
        <div class="layui-input-block">
            <textarea name="desc" value="" required  lay-verify="required" placeholder="请输入评审介绍" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">评审头像：</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn layui-btn-primary fileinput-button">
                <span>上传</span>
                <input type="hidden" name="facepic" id="facepic" value="">
                <input type="file" name="file" id="file">
            </button>
        </div>
    </div>
    <div class="layui-form-item review">
        <label class="layui-form-label">预览：</label>
        <div class="layui-input-block">
            <img width="150" src="" alt="">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登陆账号：</label>
        <div class="layui-input-block">
            <input type="text" name="account" value="" required  lay-verify="required" placeholder="请输入登陆账号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登陆密码：</label>
        <div class="layui-input-block">
            <input type="text" name="password" value="" required  lay-verify="required" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button id="submit" class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
            <button type="button" class="layui-btn layui-btn-primary" onclick="history.back()">返回</button>
        </div>
    </div>
</form>
{/block}

{block name="script"}
<script>
    layui.use('upload', function () {
        layui.upload.render({
            elem: '#file' //绑定元素
            ,url: '/admin/upload' //上传接口
            ,accept: 'file'
            ,done: function(res){
                //上传完毕回调
                if (res.errno != 0) {
                    layui.alert('上传失败');
                    return false;
                }
                $('#facepic').val(res.data[0]);
                $('.review img').attr('src', $('#facepic').val());
            }
        });
    });
</script>
{/block}